{% extends "element/saas/base_mini.html" %}

{% block meta_title %}企业征信报告检索{% endblock %}

{% block main %}
    <div class="admin-content">
        <div id="mainTabs" class="mini-tabs" activeIndex="0" style="width:100%;height:auto;"
             arrowPosition="side" showNavMenu="true">
            <div title="企业征信报告检索" iconCls="icon-zoomin">
                <div>
                    <form id="se_form" method="post">
                        <h2 class="title">企业征信报告检索</h2>
                        <table id="se_table">
                            <tr class="se_tr">
                                <td class="se_title">企业名称：</td>
                                <td class="se_input">
                                    <input name="ENTNAME" class="mini-autocomplete" valueField="ENTNAME"
                                           textField="ENTNAME" popupEmptyText="查无数据" loadingText="加载中..."
                                           vtype="rangeLength:2,100" url="/entmohu/" emptyText="支持模糊查询，支持曾用名">
                                </td>
                            </tr>
                            <tr class="se_tr se_hide">
                                <td class="se_title">注册号：</td>
                                <td class="se_input">
                                    <input name="REGNO" class="mini-textbox" emptyText="完整注册号"
                                           vtype="rangeLength:8,32">
                            </tr>
                            <tr class="se_tr">
                                <td class="se_title">所在地区：</td>
                                <td class="se_select">
                                    {% include "element/saas/includes/input_region.html" %}
                                </td>
                            </tr>
                            <tr class="se_tr">
                                <td class="se_title">行业分类：</td>
                                <td class="se_select">
                                    {% include "element/saas/includes/input_nic.html" %}
                                </td>
                            </tr>
                            <tr class="se_tr se_hide">
                                <td class="se_title">战兴产业分类：</td>
                                <td class="se_select">
                                    {% include "element/saas/includes/input_elseic.html" %}
                                </td>
                            </tr>
                            <tr class="se_tr">
                                <td class="se_title">企业状态</td>
                                <td class="se_select">
                                    <input name="ENTSTATUS" class="mini-combobox" showNullItem="true"
                                           url="/static/element/saas/form_render/entstatus.json"/>
                                </td>
                            </tr>
                            <tr class="se_tr">
                                <td class="se_title">注册资金：</td>
                                <td class="se_range">
                                    <input name="REGCAP1" class="mini-textbox" style="width:45%;float:left;"
                                           vtype="range:0,10000000" emptyText="万元"/>
                                    <span class="se_line">一</span>
                                    <input name="REGCAP2" class="mini-textbox" style="width:45%;float:left;"
                                           vtype="range:0,10000000" emptyText="万元"/>
                                </td>
                            </tr>
                            <tr class="se_tr">
                                <td class="se_title">开业日期：</td>
                                <td class="se_range">
                                    <input name="ESDATE1" class="mini-datepicker" allowinput="false"
                                           ondrawdate="onDrawDate" style="width:45%;float:left;"/>
                                    <span class="se_line">一</span>
                                    <input name="ESDATE2" class="mini-datepicker" allowinput="false"
                                           ondrawdate="onDrawDate" style="width:45%;float:left;"/>
                                </td>
                            </tr>
                            <tr class="se_tr">
                                <td class="se_title">企业类型：</td>
                                <td class="se_select">
                                    {% include "element/saas/includes/input_enttype.html" %}
                                </td>
                            </tr>
                            <tr class="se_tr">
                                <td class="se_title">总营收：</td>
                                <td class="se_range">
                                    <input name="revenue1" class="mini-textbox" style="width:45%;float:left;"
                                           vtype="range:0,1000000" emptyText="万元"/>
                                    <span class="se_line">一</span>
                                    <input name="revenue2" class="mini-textbox" style="width:45%;float:left;"
                                           vtype="range:0,1000000" emptyText="万元"/>
                                </td>
                            </tr>
                            <tr class="se_tr">
                                <td class="se_title">总利润：</td>
                                <td class="se_range">
                                    <input name="total_profit1" class="mini-textbox" style="width:45%;float:left;"
                                           vtype="range:0,1000000" emptyText="万元"/>
                                    <span class="se_line">一</span>
                                    <input name="total_profit2" class="mini-textbox" style="width:45%;float:left;"
                                           vtype="range:0,1000000" emptyText="万元"/>
                                </td>
                            </tr>
                            <tr class="se_tr se_hide">
                                <td class="se_title">总资产：</td>
                                <td class="se_range">
                                    <input name="assets_re1" class="mini-textbox" style="width:45%;float:left;"
                                           vtype="range:0,1000000" emptyText="万元"/>
                                    <span class="se_line">一</span>
                                    <input name="assets_re2" class="mini-textbox" style="width:45%;float:left;"
                                           vtype="range:0,1000000" emptyText="万元"/>
                                </td>
                            </tr>
                            <tr class="se_tr se_hide">
                                <td class="se_title">经营范围：</td>
                                <td class="se_input">
                                    <input name="OPSCOPE" class="mini-textbox" vtype="rangeLength:2,20"
                                           emptyText="关键词模糊查询">
                                </td>
                            </tr>
                            <tr class="se_tr se_hide">
                                <td class="se_title">年进口额：</td>
                                <td class="se_range">
                                    <input name="timport1" class="mini-textbox" style="width:45%;float:left;"
                                           vtype="range:0,1000000" emptyText="万美元"/>
                                    <span class="se_line">一</span>
                                    <input name="timport2" class="mini-textbox" style="width:45%;float:left;"
                                           vtype="range:0,1000000" emptyText="万美元"/>
                                </td>
                            </tr>
                            <tr class="se_tr se_hide">
                                <td class="se_title">年出口额：</td>
                                <td class="se_range">
                                    <input name="texport1" class="mini-textbox" style="width:45%;float:left;"
                                           vtype="range:0,1000000" emptyText="万美元"/>
                                    <span class="se_line">一</span>
                                    <input name="texport2" class="mini-textbox" style="width:45%;float:left;"
                                           vtype="range:0,1000000" emptyText="万美元"/>
                                </td>
                            </tr>
                            <tr class="se_tr se_hide">
                                <td class="se_title">产业标签：</td>
                                <td class="se_input">
                                    <input name="enttag" class="mini-textbox" emptyText="敬请期待"
                                           vtype="rangeLength:2,30">
                                </td>
                            </tr>
                            <tr class="se_tr">
                                <td class="se_title">排序指标：</td>
                                <td class="se_select">
                                    <input class="mini-radiobuttonlist" textField="text" valueField="value"
                                           name="se_sortindex"
                                           repeatItems="9" data=se_sortindexData value="0" required/>
                                </td>
                            </tr>
                            <tr class="se_tr">
                                <td class="se_title">排序方式：</td>
                                <td class="se_select">
                                    <input class="mini-radiobuttonlist" textField="text" valueField="value"
                                           name="se_sortby"
                                           repeatItems="9" data=se_sortbydata value="desc" required/>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="se_more" val="0">
                                    <hr/>
                                    <span><em>更多筛选条件</em><i class="se_icon am-icon-sort-desc"></i></span>
                                </td>
                            </tr>
                        </table>
                        <div class="btns">
                            <button type="button" class="am-btn am-btn-default" id="clearbtn">清除</button>
                            <button type="button" class="am-btn am-btn-secondary" id="searchbtn"
                                    onclick="Adsearch()">搜索
                            </button>
                        </div>
                    </form>
                </div>
            </div>
            <div title="检索结果列表" name="主数据表" url="/saas/search_result/" iconCls="icon-date" height="auto"></div>
        </div>
    </div>
{% endblock %}

{% block footer_js %}
    <script type="text/javascript">
        var se_sortindexData = [
            {'value': '0', 'text': '默认'},
            {'value': 'REGCAP', 'text': '注册资金'},
            {'value': 'ESDATE', 'text': '开业日期'},
            {'value': 'revenue', 'text': '总营收'},
            {'value': 'total_profit', 'text': '总利润'},
            {'value': 'assets_re', 'text': '总资产'},
            {'value': 'timport', 'text': '进口额'},
            {'value': 'texport', 'text': '出口额'}
        ];
        var se_sortbydata = [
            {'value': 'desc', 'text': '降序'},
            {'value': 'asc', 'text': '升序'}
        ];
        mini.parse();
        var form_search = new mini.Form("se_form");
        var tabs = mini.get("mainTabs");
        var listtab = tabs.getTab("主数据表");
        top["win"] = window;
        $("#clearbtn").click(function () {
            form_search.reset();
        });
        $(".se_more").click(function () {
            var val = $(".se_more").attr("val");
            var icon = $(".se_more .se_icon");
            if (val == 0) {
                $(".se_hide").show();
                $(".se_more em").text("收 起 更 多");
                icon.removeClass("am-icon-sort-desc").addClass("am-icon-sort-asc");
                $(".se_more").attr("val", "1");
            }
            else {
                $(".se_hide").hide();
                $(".se_more em").text("更多筛选条件");
                icon.removeClass("am-icon-sort-asc").addClass("am-icon-sort-desc");
                $(".se_more").attr("val", "0");
            }
        });
        function Adsearch() {
            form_search.validate();
            if (form_search.isValid() == false) return;
            {#生成搜索数据#}
            var svalue = fclean(mini.getbyName("ENTNAME").getValue()) + '￥'
                + fclean(mini.getbyName("REGNO").getValue()) + '￥'
                + fclean(mini.getbyName("region_id").getValue()) + '￥'
                + fclean(mini.getbyName("nic_id").getValue()) + '￥'
                + fclean(mini.getbyName("elseic_id").getValue()) + '￥'
                + fclean(mini.getbyName("ENTSTATUS").getValue()) + '￥'
                + fclean(mini.getbyName("enttype_id").getValue()) + '￥'
                + fclean(mini.getbyName("OPSCOPE").getValue()) + '￥'
                + fclean(mini.getbyName("REGCAP1").getValue()) + '$' + fclean(mini.getbyName("REGCAP2").getValue()) + '￥'
                + fclean(mini.formatDate(mini.getbyName("ESDATE1").getValue(), "yyyy-MM-dd")) + '$'
                + fclean(mini.formatDate(mini.getbyName("ESDATE2").getValue(), "yyyy-MM-dd")) + '￥'
                + fclean(fwan(mini.getbyName("revenue1").getValue())) + '$'
                + fclean(fwan(mini.getbyName("revenue2").getValue())) + '￥'
                + fclean(fwan(mini.getbyName("total_profit1").getValue())) + '$'
                + fclean(fwan(mini.getbyName("total_profit2").getValue())) + '￥'
                + fclean(fwan(mini.getbyName("assets_re1").getValue())) + '$'
                + fclean(fwan(mini.getbyName("assets_re2").getValue())) + '￥'
                + fclean(mini.getbyName("timport1").getValue()) + '$' + fclean(mini.getbyName("timport2").getValue()) + '￥'
                + fclean(mini.getbyName("texport1").getValue()) + '$' + fclean(mini.getbyName("texport2").getValue());
            if (svalue != '￥￥￥￥￥￥￥￥$￥$￥$￥$￥$￥$￥$') {
                var se_sortby = mini.getbyName("se_sortby").getValue();
                var se_sortindex = mini.getbyName("se_sortindex").getValue();
                var new_url = '/saas/search_result/?pageIndex=0&svalue=' + svalue + '&sortField=' + se_sortindex + '&sortOrder=' + se_sortby;
                listtab.url = encodeURI(new_url);
                tabs.reloadTab(listtab);
                tabs.activeTab(listtab);
            }
        }
    </script>
    {{ block.super }}
{% endblock %}
